﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.UserRoleCommand;
using RBAC.MaHaiBo.Entity;
using RBAC.MaHaiBo.Service;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.UserRolehandler
{
    public class UserRoleCreateCommandHandler :IRequestHandler<UserRoleCreateCommand,int>
    {
        IUserRoleService urSer;

        public UserRoleCreateCommandHandler(IUserRoleService urSer)
        {
            this.urSer = urSer;
        }

        public async Task<int> Handle(UserRoleCreateCommand request, CancellationToken cancellationToken)
        {
            return await urSer.ByAddUserRole( request.Ids, request.Rid);
        }
    }
}
